//
// Created by robot on 20-7-10.
//

#ifndef SIMULATIONCODE_TCPIPROBOT_H
#define SIMULATIONCODE_TCPIPROBOT_H
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/shm.h>
#include <pthread.h>
#include <iostream>
#include <QThread>
#define AxisNum 6
class TCPIPRobot  : public QObject {

public:
    TCPIPRobot();
    ~TCPIPRobot();
    int get_socket();
    int connect(const QString IP, int port=8000);

public slots:
    void receData();
    void receData2();
    void isstop(const bool& isstop);

signals:
    void LeftRobotConEr();
    void RightRobotConEr();

private:
    char *p;
    char **restp;
    char *delims= "," ;
    char recvbuf[1024];
    char *p2;
    char **restp2;
    char recvbuf2[1024];
    int  sock_cli=-1;

    double currentJoint0[AxisNum]={0,0,0,0,0,0};
    double currentXYZ0[AxisNum]={0,0,0,0,0,0};
    long long currentTime(void);

    bool _isstop=false;

};


#endif //SIMULATIONCODE_TCPIPROBOT_H
